const Store = require('electron-store')

class DataStore extends Store {

    //播放速度
    spd = '1'
    //剪切板内容
    playContent = ''
    //文字转语音 api选择
    ttsApi = 'https://tts.youdao.com/fanyivoice?word=__TEXT__&le=zh&keyfrom=speaker-target'

    //构造函数
    constructor(settings) {
        const baseConfig = {name: 'ctrlcq'}
        const finalConfig = {...baseConfig, ...settings};
        super(finalConfig)
    }
    //获取速度
    getSpd(){
        return this.get('spd','1')
    }
    //设置速度
    setSpd(v){
        return this.set('spd',v)
    }
    //获取播放文本
    getPlayContent(){
        return this.get('playContent','')
    }
    //设置播放文本
    setPlayContent(v){
        return this.set('playContent',v)
    }

    //获取 tts api
    getTTSApi(){
        return this.get('ttsApi','https://tts.youdao.com/fanyivoice?word=__TEXT__&le=zh&keyfrom=speaker-target')
    }
    //设置 tts api
    setTTSApi(v){
        return this.set('ttsApi',v)
    }
}

module.exports = DataStore